home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / terminal / paket61 / man09.doc < prev    next >
Encoding:
Text File  |  1994-08-15  |  17.8 KB  |  449 lines

  1. PART IX - paKet PROTOCOL (pP)
  2.  
  3. What is pP ?
  4.  
  5.   paKet Protocol, or "pP" for short, is a YAPP-compatible Binary File
  6.   Transfer protocol designed especially to provide a Recovery capability
  7.   after an aborted file transfer. It is basically the YAPP Protocol with
  8.   some additional enhancements to provide the automatic restart capability.
  9.  
  10.   Consider the situation where you are sending a Binary File to another
  11.   station and the transfer is aborted for some reason, whether it be a bad
  12.   link or power failure or any other reason. You simply send the file
  13.   again, using the same <F7> command!  With pP, the file transfer will
  14.   automatically start from where the previous transfer left off.
  15.  
  16.   pP will mostly be appreciated when you are transferring a large file and
  17.   the transfer is aborted when almost finished. For small files, or if a
  18.   transfer is aborted near the beginning, you might as well send the
  19.   entire file again.
  20.  
  21.   pP may be used to exchange Binary Files with any other station equipped
  22.   with either pP or YAPP protocol. The pP protocol automatically detects
  23.   the presence of another pP station and will use the enhanced features as
  24.   required, otherwise the standard YAPP protocol will be used.
  25.  
  26.   I used the YAPP Protocol Specifications published by Jeff Jacobsen
  27.   (WA7MBL), the author of the original YAPP program, when developing this
  28.   pP system. Extensive testing has shown pP to be fully compatible with
  29.   YAPP Protocol.
  30.  
  31.   At this stage, pP is available only with paKet.  However, the paKet
  32.   Protocol details are offered to the Public Domain and are discussed in
  33.   some detail below. I will be happy to assist developers of other YAPP
  34.   Protocol software with the pP enhancements so they too can offer this
  35.   feature in their software.
  36.  
  37.   But please note, I am offering to discuss the pP *ENHANCEMENTS* to
  38.   *EXISTING* YAPP Protocol programs. Please don't call me for assistance
  39.   with the development/debugging of Standard YAPP Protocol software!
  40.  
  41.   In the sections that follow, I give some examples of the exchange of
  42.   dialog between the two stations. For convenience here, I will refer to
  43.   the two sides as the Sender and the Receiver. So, if I use the term
  44.   "Sender" or "Receiver" I might be referring to the operator or to the
  45.   software or to the system generally, but I am sure you will get the idea.
  46.  
  47.   I hope Jeff Jacobsen will forgive me if I suggest his original YAPP
  48.   program has now been superseded but his YAPP Protocol lives on as the
  49.   current Standard for Binary File transfers in the world of Packet Radio.
  50.   In the following sections, when I refer to "YAPP", I am referring to the
  51.   YAPP Binary File Transfer Protocol, not to the original YAPP program
  52.   that started it all.
  53.  
  54.  
  55.                                Page 309
  56.  
  57. Using pP
  58.  
  59.   For most Binary File transfers, pP will behave in a similar manner to
  60.   YAPP and the performance will be the same.
  61.  
  62.   No special action is required to use pP.  Using pP is the same as using
  63.   YAPP - the procedure to send or receive a Binary File is the same.
  64.  
  65.   Refer to the <F7> and <F8> keys in the "Keyboard Commands" section of
  66.   this Manual for operational details.
  67.  
  68.  
  69.  Typical scenario:
  70.  
  71.   Say you are sending a Binary File to another pP station. You send the
  72.   file in the usual way, starting with the <F7> key.
  73.  
  74.   The transfer begins just like any other Binary File transfer starting
  75.   from the beginning of the file.
  76.  
  77.   Then part way through, let's say after sending half the file, something
  78.   goes wrong.  Ummm, for this illustration we'll say the digipeater we
  79.   were using goes off the air and we lose the link with the other station.
  80.  
  81.   So, call up using a different path and establish communications with
  82.   that station again.  Then start the same file transfer again, using the
  83.   same <F7> key again, specifying the same filename again. Come to think
  84.   of it, this is what you would do anyway, isn't it? Whether using pP or
  85.   not! But with most other protocols, the entire file would be resent from
  86.   the beginning. With pP, a Recovery is possible.
  87.  
  88.   When the file transfer is started again, the following activity takes
  89.   place (assuming both stations support pP):
  90.  
  91.      1. The exchange of pP/YAPP initialisation codes verifies each station
  92.         is ready to start the transfer (standard YAPP Protocol).
  93.  
  94.      2. The Sender sends the Protocol header, which includes the file name
  95.         and file size (standard YAPP protocol). The header also includes a
  96.         new field to identify this station as a pP station.
  97.  
  98.      3. The Receiver detects that this file already exists on that system
  99.         and is smaller than the one about to be received. (The file is
  100.         smaller because it is only half there!)
  101.  
  102.         The Receiver now knows that the Sender is a pP station because of
  103.         the additional field in the header.
  104.  
  105.      4. The Receiver requests a pP recovery and sends some details of its
  106.         (shorter) file.
  107.  
  108.      5. The Sender checks those details against the file about to be sent.
  109.         It looks like the same file, so the Sender issues an approval then
  110.         starts sending from the agreed point in the file.
  111.                                Page 310
  112.  
  113.  
  114.         (If the Sender decides it does not look like the same file, the
  115.         Recovery request would be denied and the transfer would start from
  116.         the beginning).
  117.  
  118.      6. When the Receiver gets the Recovery approval, that system will
  119.         reset the file pointers and will start writing any data received
  120.         at the agreed starting point in the file, effectively appending to
  121.         the existing file.
  122.  
  123.      7. The transfer then continues from that point using standard YAPP
  124.         Protocol.
  125.  
  126.   While all this is going on, you do nothing - just watch the messages
  127.   informing you of the exchange of pP dialogue as outlined above. Then
  128.   when the Binary File Transfer Window appears you will see the file
  129.   transfer is already partly completed! It has picked up almost from where
  130.   it left off.
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.                                Page 311
  168.  
  169. The technical details of the paKet Protocol:
  170.  
  171.   For this discussion I will be referring to some of Jeff Jacobsen's YAPP
  172.   Specifications. If you are a developer of YAPP compatible software, you
  173.   will already know about these things. If you are an interested user and
  174.   do not have these specifications handy, I will try to explain as I go.
  175.  
  176.   A warning though... this section does get a bit heavy and is included
  177.   for the technically minded. If you find you are having trouble
  178.   understanding it, just skip to another section - it is NOT necessary to
  179.   understand all this in order to use pP.
  180.  
  181.  
  182. Sender   - Sending a pP/YAPP Header
  183.  
  184.   The YAPP Header is listed in the YAPP specifications as follows:
  185.   HD    Send_Hdr
  186.   <SOH> <len> (Filename) <NUL> (File Size in ASCII) <NUL> (Opt)
  187.  
  188.   (The "< >" combination is used to indicate single byte values).
  189.  
  190.   This header is sent at the beginning of the transfer to identify the
  191.   name and size of the file about to be sent. Note there is an optional
  192.   field provided, and it is this optional field that pP uses to identify
  193.   the Sender as a pP station.
  194.  
  195.   When the Sender sends a file header, the "optional" field will contain
  196.   the pP Identifier string, "paKet-Protocol" (without the quotes).
  197.  
  198.   So if we were sending a file "PROG.EXE" and that file was 74692 bytes
  199.   long, the pP header might look like:
  200.      <SOH><29>PROG.EXE<NUL>74692<NUL>paKet-Protocol
  201.  
  202.   This optional field should be sent with every Header. If the Receiver is
  203.   running Standard YAPP Protocol it will not get upset because the
  204.   optional field is provided for in the Specifications. Testing with
  205.   various YAPP Protocol systems has shown this works without problems,
  206.   however should some system somewhere object to this optional field being
  207.   used in this way, the paKet user can switch off the pP option in the
  208.   Configuration - File Transfer options. In that case the Sender would not
  209.   send the optional field and the Receiver will think we are running
  210.   Standard YAPP Protocol!  I have yet to find a system that misbehaves so
  211.   you would normally leave the pP option ON in your Configuration.
  212.  
  213.  
  214. Receiver - Receiving a pP/YAPP Header and requesting Recovery
  215.  
  216.   When the Header is received, the Receiver will check the Header's file
  217.   details. If that file does not yet exist it will create a new file, send
  218.   an <ACK> to the Sender and continue with the transfer using Standard
  219.   YAPP Protocol.
  220.  
  221.   If a file of the same name already exists on the Receiver system it
  222.   could be just another version of the same file or maybe it is the result
  223.                                Page 312
  224.  
  225.   of an earlier transfer attempt that was not completed. If it is a partly
  226.   completed copy of an earlier transfer attempt, pP can identify this and
  227.   perform a Recovery. If it is not that same file, pP can recognise this
  228.   too and revert to Standard YAPP Protocol for a "normal" transfer of the
  229.   entire file.
  230.  
  231.   The Receiver will request a pP Recovery if the following conditions are
  232.   ALL met:
  233.       1. a file already exists with the same file name;
  234.                               and
  235.       2. The size of the existing file is greater than 1000 bytes;
  236.                               and
  237.       3. The file size is smaller than that in the Header just received;
  238.                               and
  239.       4. the Header contains the "paKet-Protocol" identifier;
  240.                               and
  241.       5. the user of this Receiver system has indicated in the
  242.          Configuration that pP may be used.
  243.          (This last condition is implemented in paKet but is an optional
  244.          feature of the pP Protocol).
  245.  
  246.  
  247.   Let's discuss briefly each of these requirements.
  248.  
  249.   1. If the file does not yet exist, there is no need for Recovery and a
  250.      standard YAPP Protocol transfer will take place.
  251.  
  252.   2. You will see later that a Recovery does not actually begin from the
  253.      end of this short file, but begins 750 bytes back from the end. If
  254.      the Receiver's file is shorter than 1000 bytes, it is hardly worth a
  255.      Recovery anyway!  We might just as well start again from the
  256.      beginning.
  257.  
  258.   3. If the Receiver's file is already bigger than the one about to be
  259.      sent, it is certainly NOT the result of an aborted transfer of this
  260.      same file!
  261.  
  262.   4. If the Header does not contain the pP identifier, the Sender is not
  263.      running pP. There is no point in asking a non-pP system for a
  264.      Recovery!
  265.  
  266.   5. The paKet user may disable the pP facility, so the ultimate control
  267.      remains with the user. This option is provided in paKet but is not a
  268.      requirement of the Protocol. Another program that supports pP might
  269.      not provide this user option.
  270.  
  271.   If all the above conditions are met and the Receiver decides to request
  272.   a Recovery, a "NP" record is prepared and sent to the Sender. This NP
  273.   record is defined below:
  274.  
  275.  
  276.  
  277.  
  278.  
  279.                                Page 313
  280.  
  281.  NP record.
  282.  
  283.   The YAPP Specifications include an NR record for a negative
  284.   acknowledgement ("Not Ready" sometimes referred to as NAK). The standard
  285.   NR record provides for the <NAK> code followed by an optional "reason"
  286.   in ASCII.
  287.  
  288.   Using this format with the optional field to maintain compatibility
  289.   with the Standard YAPP Protocol, I have created a new Protocol record
  290.   and I called it NP. This new record is:
  291.  
  292.  
  293.   NP    pP Recovery request
  294.   <NAK><len>paKet-Protocol,(length of file),(first 100 bytes)(last 100 bytes)
  295.  
  296.   - The <NAK> is the ASCII code with a value of 21;
  297.  
  298.   - <len> is the length of the following data;
  299.  
  300.   - The pP identifier string "paKet-Protocol" comes next (14 bytes).
  301.     This is the optional "reason" provided for in the YAPP Specifications!;
  302.  
  303.   - The length of the file is actually the length of the file on the
  304.     Receiver's system LESS 850 bytes. (Further discussion on this below)
  305.  
  306.     The value is sent as ASCII characters and please note there are commas
  307.     before and after these numbers.
  308.  
  309.     So, if the file on the Receiver's system is 53,964 bytes, this field
  310.     would contain the following seven ASCII characters:
  311.        ,53114,
  312.  
  313.   - The first 100 bytes of the short file on the Receiver system;
  314.  
  315.   - The "last" 100 bytes of the short file on the Receiver system.
  316.  
  317.   To get the "last" 100 bytes the Receiver system will move to a position
  318.   850 bytes back from the end of the file and read the next 100 bytes
  319.   from there. So the last 750 bytes will be ignored and if a Recovery is
  320.   successful, those 750 bytes will be overwritten.
  321.  
  322.   This figure of 850 bytes is somewhat arbitrary. I felt it was necessary
  323.   to provide SOME overlap to cover the situation where the end of the
  324.   short file might be corrupted (it WAS aborted for some reason, don't
  325.   forget!). If you are developing your own pP system, feel free to choose
  326.   another figure - this affects only the Receiver, so your system can
  327.   still perform a Recovery from paKet (or any other pP system). I would
  328.   suggest a larger rather than a shorter figure should be chosen if you
  329.   wish to change it. You might like to reduce the overlap to save time on
  330.   duplicating the data already sent, but keep in mind it takes only a
  331.   second or two to send 100 bytes and the Recovery could save many
  332.   minutes, maybe an hour! I don't think the user will get upset if it
  333.   takes a few seconds to Recover.
  334.  
  335.                                Page 314
  336.  
  337.   So, as an example, an NP record might look like:
  338.      <NAK><221>paKet-Protocol,53114,........
  339.   (the dots represent the 200 data bytes).
  340.  
  341. Sender   - Processing a Recovery request (NP record) from the Receiver
  342.  
  343.   After sending the Header, the Sender would usually get an RF packet
  344.   indicating the other station is now ready to "Receive the File". In that
  345.   case the entire file is sent from the beginning in accordance with the
  346.   Standard YAPP Protocol.
  347.  
  348.   If the Sender gets the NP packet, it means the other station is
  349.   requesting a pP Recovery. It could be they already have part of this
  350.   file so it is now up to the Sender to decide whether it is or is not the
  351.   same file. Of course the only way to be really sure about this is to
  352.   compare the entire file but if we are going to do this we might as well
  353.   send the whole thing again!
  354.  
  355.   I decided it is a reasonable risk to compare the first 100 bytes of the
  356.   two files, then to compare the last 100 bytes of the files. (The "last"
  357.   100 bytes in this case would be somewhere in the middle of the Sender's
  358.   file.) If these 200 bytes match - same values at the same locations and
  359.   the two files have the same name, then pP will accept they ARE the same
  360.   file and the Recovery will be approved.
  361.  
  362.   The NP packet includes the size of the file on the Receiver's system,
  363.   the first 100 bytes plus the last 100 bytes of that file. So the Sender
  364.   system will access the file about to be sent and will compare the first
  365.   100 bytes. If they are all the same, it will move down the file to the
  366.   location corresponding to the file size given in the NP record. If the
  367.   next 100 bytes in the file also match those given in the NP record, a
  368.   Recovery will be approved.
  369.  
  370.   If even one byte does not match, the Recovery will be denied.
  371.  
  372.   So, if the Sender approves the Recovery, it will send the "Approval for
  373.   Recovery" packet, the "AP" record, which is a new Protocol record and
  374.   consists of two bytes:
  375.      <ACK><6>
  376.   Then it will position the file pointer to the file size given by the NP
  377.   record plus 100 bytes. (Those "last" 100 bytes have been matched so
  378.   there's no need to send them again.)  And the file transfer continues
  379.   from that point using Standard YAPP Protocol.
  380.  
  381.   If the Sender denies the Recovery, it will send the "Recovery Denied"
  382.   packet, the "DN" record. This too, is a new Protocol record and consists
  383.   of 16 bytes to distinguish it from an "ordinary" NAK:
  384.      <NAK><14>paKet-Protocol
  385.   As the Recovery has been denied, the file will be sent in its entirety
  386.   and the transfer will proceed using Standard YAPP Protocol, starting
  387.   from the beginning of the file.
  388.  
  389.  
  390.  
  391.                                Page 315
  392.  
  393. Receiver - Processing Response to Recovery request.
  394.  
  395.   This is the final stage of the Recovery process. The Receiver had
  396.   requested a Recovery and now will find out whether the Recovery is
  397.   approved or denied. The Receiver will get either an Approval (AP record)
  398.   or a Denial (DN record). Details of these records are shown in the
  399.   previous section.
  400.  
  401.   If the Recovery is approved, the Receiver will adjust the file pointer
  402.   to the file size less 750 bytes.
  403.  
  404.   Yes, that's right 750! We moved back 850 bytes into the file to include
  405.   the "last" 100 bytes in the the NP record. Now that we have an approval,
  406.   we know those "last" 100 bytes are OK so there's no need to transfer
  407.   them again. We will start receiving data from AFTER those "last" 100
  408.   bytes, overwriting the last 750 bytes in the file.  (See comments above
  409.   under "NP Record" - you may vary this "setback" figure of 850 bytes if
  410.   you are developing your own pP software).
  411.  
  412.   If Recovery is denied, the entire file will be sent so the Receiver will
  413.   either have to overwrite the existing file or create a new one.
  414.  
  415.   I would like to point out here that if the paKet program is receiving a
  416.   file and Recovery is denied, the existing (short) file will be preserved
  417.   and a new file with a different extension (eg: .000 or .001 etc) will be
  418.   created. This is a feature of the paKet program NOT part of the pP file
  419.   transfer Protocol.  pP just manages the Recovery process. So if some
  420.   other program uses pP it might handle "Recovery Denied" differently by
  421.   simply producing an error message such as "File Exists" or it might
  422.   overwrite the existing short file.
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.                                Page 316
  448.  
  449.